//
//  XRSelfLoginShareFootView.m
//  XClassRoom
//
//  Created by 余伟 on 2017/1/4.
//  Copyright © 2017年 Mr-yuwei. All rights reserved.
//

#import "XRSelfLoginShareFootView.h"

@interface XRSelfLoginShareFootView()
{
    UIImageView  *_weChatImageView;
    UIImageView  *_QQImageView;
    UIImageView  *_sinaChatImageView;
}
@end
@implementation XRSelfLoginShareFootView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame])
    {
        [self addOwnView];
    }
    return self;
}
-(void)addOwnView
{
    [self addCribesLableView];
    [self addshareImageView];
}
-(void)addshareImageView
{
    _weChatImageView=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_weixin"]];
    [self  addSubview:_weChatImageView];
    [_weChatImageView mas_makeConstraints:^(MASConstraintMaker *make)
     {   make.center.equalTo(self);
         make.height.width.mas_equalTo(35);
    }];
    _weChatImageView.tag=100+1;
    _QQImageView =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_qq"]];
    [self addSubview:_QQImageView];
    [_QQImageView mas_makeConstraints:^(MASConstraintMaker *make)
     {   make.centerY.equalTo(self);
         make.right.equalTo(_weChatImageView.mas_left).offset(-50);
         make.height.width.mas_equalTo(35);
    }];
    _QQImageView.tag=100+0;
    _sinaChatImageView =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_xinlang"]];
    [self addSubview:_sinaChatImageView];
    [_sinaChatImageView mas_makeConstraints:^(MASConstraintMaker *make)
    {   make.centerY.equalTo(self);
        make.left.equalTo(_weChatImageView.mas_right).offset(50);
        make.height.width.mas_equalTo(35);
    }];
    _sinaChatImageView.tag=100+2;
    [self addtapwithimageView:_sinaChatImageView];
    [self addtapwithimageView:_weChatImageView];
    [self addtapwithimageView:_QQImageView];
}
-(void)addCribesLableView
{
    UILabel  *lable=[[UILabel alloc] init];
    lable.text=@"----使用合作账号登录----";
    lable.textColor=kBlackColor;
    lable.textAlignment=NSTextAlignmentCenter;
    lable.font=[UIFont systemFontOfSize:13];
    [self addSubview:lable];
    [lable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self);
        make.height.mas_equalTo(21);
    }];
}
-(void)addtapwithimageView:(UIImageView *)imageView
{
    imageView.userInteractionEnabled=YES;
    UITapGestureRecognizer  *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImageViewWithGes:)];
    [imageView addGestureRecognizer:tap];
    
}
-(void)clickImageViewWithGes:(UIGestureRecognizer*)tap
{
    if (self.delegate&&[self.delegate respondsToSelector:@selector(XRSelfLoginShareFootViewclickAtIndex:)])
    {
      [self.delegate XRSelfLoginShareFootViewclickAtIndex:tap.view.tag-100];
    }
}

@end
